import { lazy } from "react";

// 前端路由的配置文件
// import LoginCode from "../pages/Login/LoginCode";
// import LoginPassword from "../pages/Login/LoginPassword";
// import RegisterPhone from "../pages/Register/RegisterPhone";
// import RegisterCode from "../pages/Register/RegisterCode";
// import RegisterPassword from "../pages/Register/RegisterPassword";
// import CountryPicker from "../components/CountryPicker";
// import Home from "../pages/Home";

/*
  路由懒加载
    1. 将组件进行单独打包，单独打包成一个js文件和css文件
    2. 按需加载，需要用到的组件才会加载，不用的不加载
*/
const LoginCode = lazy(() => import("../pages/Login/LoginCode"));
const LoginPassword = lazy(() => import("../pages/Login/LoginPassword"));
const RegisterPhone = lazy(() => import("../pages/Register/RegisterPhone"));
const RegisterCode = lazy(() => import("../pages/Register/RegisterCode"));
const RegisterPassword = lazy(() =>
  import("../pages/Register/RegisterPassword")
);
const CountryPicker = lazy(() => import("../components/CountryPicker"));
const Home = lazy(() => import("../pages/Home"));

// 路由的配置项
const routes = [
  {
    path: "/",
    component: Home,
  },
  {
    path: "/login/code",
    component: LoginCode,
  },
  {
    path: "/login/password",
    component: LoginPassword,
  },
  {
    path: "/register/phone",
    component: RegisterPhone,
  },
  {
    path: "/register/code",
    component: RegisterCode,
  },
  {
    path: "/register/password",
    component: RegisterPassword,
  },
  {
    path: "/countryPicker",
    component: CountryPicker,
  },
  // {
  //   path: "/xxx",
  //   component: CountryPicker,
  // },
  // {
  //   path: "/yyy",
  //   component: CountryPicker,
  // },
];

// 暴露出去
export default routes;
